package com.ssfGame.puremvc.controller.load
{
	
	
	import com.game.utils.GlobalFun;
	import com.ssfGame.puremvc.StaticConst;
	import com.ssfGame.puremvc.model.ConfigProxy;
	import com.ssfGame.puremvc.model.vo.ConfigVO;
	import com.ssfGame.puremvc.view.module.queueload.vo.QueueLoadVO;
	
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	
	/**
	 * 加载配置文件
	 * @author chery
	 */
	public class LoadConfigCommand extends SimpleCommand
	{
		public function LoadConfigCommand()
		{
			super();
		}
		override public function execute(notification:INotification):void{
			var queueLoadVO:QueueLoadVO=StaticConst.getQueueLoadVO(onComplete,StaticConst.V_JSON,StaticConst.configUrl+"?v="+Math.random(),StaticConst.configUrl);
			sendNotification(StaticConst.N_C_LOAD,queueLoadVO);
		}
		private function onComplete(qVO:QueueLoadVO):void{
			var _configVO:ConfigVO=(facade.retrieveProxy(ConfigProxy.NAME) as ConfigProxy).configVO;
			GlobalFun.setObjData(_configVO,qVO.loadVec[0].data);
			StaticConst.configVO=_configVO;
			StaticConst.RESOURCE_URL=_configVO.RESURL;
			StaticConst.apiType=_configVO.API_TYPE;
			sendNotification(StaticConst.N_C_LOAD_INITLOADER);
			
		}
									
	}
}